﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SignalShopBase
{
    public class Signal
    {
        private int iN;
        public int N { get { return iN; } }

        private Complex[] data;

        public Complex this[int index]
        {
            get
            {
                if ((index < (-1 * iN)) || (index > iN))
                    throw new ArgumentOutOfRangeException("Index", index, "Index is out of range.");

                return data[iN + index];
            }

            set
            {
                if ((index < (-1 * iN)) || (index > iN))
                    throw new ArgumentOutOfRangeException("Index", index, "Index is out of range.");

                data[iN + index].Set(value);
            }            
        }
        
        public Signal(int N)
        {
            this.iN = N;

            data = new Complex[2 * iN + 1];

            for (int i = 0; i < data.Length; i++)
            {
                data[i] = new Complex();
            }
        }
    }
}
